<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }

        .hhh{
            width: 800px;
        }

        .swiper-slide {
            background-color: pink;
            font-size: 100px;
            display: flex;
            justify-content: center;
            align-items: center;
        }
    </style>
    <link rel="stylesheet" href="./swiper.min.css">
    <script src="./swiper.min.js"></script>
</head>

<body>
    <div class="hhh">
        <div class="swiper-container">
            <!-- 每一屏的那个容器 -->
            <div class="swiper-wrapper">
                <!-- 每一屏所要展示的内容 -->
                <div class="swiper-slide">Slide 1</div>
                <div class="swiper-slide">Slide 2</div>
                <div class="swiper-slide">Slide 3</div>
                <div class="swiper-slide">Slide 4</div>
            </div>
            <!-- 小圆点的容器 -->
            <div class="swiper-pagination"></div>
            <!-- 左右按钮的容器 -->
            <div class="swiper-button-next"></div>
            <div class="swiper-button-prev"></div>
        </div>
    </div>
    <script>
        new Swiper(document.querySelector('.swiper-container'), {
            spaceBetween: 30, //在控制每屏间隔距离
            autoplay: {
                delay: 2000, //延迟时间  当前屏显示时间
                disableOnInteraction: false,  //控制鼠标操作后要不要禁用自动轮播
            },
            pagination: {
                el: '.swiper-pagination', //选中小圆点容器
                clickable: true, //控制小圆点是否可以被点击
            },
            navigation: {
                // 获取左右按钮的容器
                nextEl: '.swiper-button-next',
                prevEl: '.swiper-button-prev',
            },
        });
    </script>
</body>

</html>